package be.cosic.credentialissuer.interfaces;

public interface SecurityParameters {
	public final static int L_n = 1024 ;//in bytes
	public final static int L_f = 160;
	public final static int L_e = 410;
	public final static int L_ep = 120;
	public final static int L_v = 1512;
	public final static int L_phi = 80;
	public final static int L_H = 160;
	
	/*
	 ******************* Definition of constants *******************
	 */
	
	public final static byte INS_JOIN_SPK 		= (byte) 0x01;
	public final static byte INS_JOIN_SETV 	= (byte) 0x02;
	// INS BYTES - protocol commands
	public final static byte INS_SPK_REQ 		= (byte) 0x10;
	public final static byte INS_STEP_20 		= (byte) 0x20;
	public final static byte INS_STEP_21 		= (byte) 0x21;
	public final static byte INS_STEP_22 		= (byte) 0x22;
	
	public final static byte INS_HEXP_REQ 		= (byte) 0x30;
	public final static byte INS_HEXP_01 		= (byte) 0x31;
	// INS BYTES - applet initialisation and debugging commands
	public final static byte INS_SET_KEY 		= (byte) 0xF1;
	public final static byte INS_GET_KEY 		= (byte) 0xF2;
	public final static byte INS_GET_INTER 	= (byte) 0xF3;
	public final static byte INS_SET_INTER 	= (byte) 0xF4;
	public final static byte FIX_RAND 			= (byte) 0xFE;
	public final static byte INS_LOCK 			= (byte) 0xFF;
	
	// PARAMETER VALUES (GET/SET) - Issuer public key
	public final static byte SET_GET_R 		= (byte) 0x01;
	public final static byte SET_GET_S 		= (byte) 0x02;
	public final static byte SET_GET_N 		= (byte) 0x03;
	// PARAMETER VALUES (GET/SET) - Card secret key
	public final static byte SET_GET_F 		= (byte) 0x11;
	public final static byte SET_GET_V 		= (byte) 0x12;
	// PARAMETER VALUES (GET/SET) - Intermediate values
	public final static byte SET_GET_RV 		= (byte) 0x01;
	public final static byte SET_GET_RF 		= (byte) 0x02;
	public final static byte SET_GET_NT 		= (byte) 0x03;
	
	// VARIABLE LENGTHS (in number of bytes)(CHANGE!)
	public final static byte 	LENGTH_F		= 20;
	public final static short 	LENGTH_V 		= 189;
	public final static short 	LENGTH_R 		= 128;
	public final static short 	LENGTH_S 		= 128;
	public final static short 	LENGTH_N 		= 128;
	public final static byte 	LENGTH_PHI 		= 10;
	public final static byte 	LENGTH_H 		= 20;
	public final static short 	LENGTH_VPRIME	= LENGTH_N+LENGTH_PHI;
	public final static short 	LENGTH_RV 		= LENGTH_V + LENGTH_PHI + LENGTH_H; 	//219
	public final static byte 	LENGTH_RF 		= LENGTH_F + LENGTH_PHI + LENGTH_H;		//50
	public final static byte 	LENGTH_CH 		= 20;
	public final static byte 	LENGTH_M 		= 20;
	public final static byte 	LENGTH_NT 		= 10;
	public final static short 	LENGTH_TMP 		= 513;
	public final static short 	LENGTH_SV 		= LENGTH_RV + 1;	//max(LENGTH_RV, LENGTH_V+LENGTH_H)+1
	public final static short 	LENGTH_SF 		= LENGTH_RF + 1;	//max(LENGTH_RF, LENGTH_F+LENGTH_H)+1
	//public final static short 	LENGTH_RSA 		= KeyBuilder.LENGTH_RSA_1024;
	//public final static short 	LENGTH_RSA_BYTES= (short)(LENGTH_RSA/8);
	//public final static short 	LENGTH_RV_EXP 	=(short)( LENGTH_RV - LENGTH_RSA_BYTES + 1);
	//public final static short 	LENGTH_V_EXP 	= (short)(LENGTH_V - LENGTH_RSA_BYTES + 1);
	public final static byte 	LENGTH_D		= 20;
	
	
	// other constants
	public final static byte[] TWOa 			= {(byte)0x02};
	public final static byte 	ZERO 			= 0;
	public final static byte 	ONE 			= 1;
	public final static short 	MAX_BYTE 		= 0x00FF;
	
}
